@layout("/common/_container.html"){
<div class="ibox float-e-margins">
    <style>
    td{
    padding-left:3px;
    }
	</style>
    <div>
        <div class="form-horizontal" style='overflow:scroll;'>
        	
			<div>
			<form id="receiveContract">
				 <input type="hidden" id="id" name="id" value="${item.receiveBasicInformation.id}">
				<table border="1"  width="1000px">
					<tr>
						<td>基本信息：</td>
						<td colspan="9"></td>
					</tr>
					<tr>
						<td width="105px">合同号:</td>
						<td width="115px" >${item.receiveBasicInformation.receive_contract_number}</td>
						<td width="105px">起运日期:</td>
						<td width="125px"  >${tool.dateType(item.receiveBasicInformation.receive_start_date)}</td>
						<td width="125px">到货日期:</td>
						<td width="125px" >${tool.dateType(item.receiveBasicInformation.receive_arrival_date)}</td>
						<td width="105px">制单员:</td>
						<td >${item.receiveBasicInformation.receive_trade_person}</td>
						<td width="105px">审核员:</td>
						<td id="username" >${item.receiveBasicInformation.receiveCheck}</td>
					</tr>
					<tr>
						<td>发货人:</td>
						<td >${item.receiveBasicInformation.receiveConsigner}</td>
						<td>发货人电话：</td>
						<td >${item.receiveBasicInformation.receiveConsignerTell}</td>
						<td>发货人地址：</td>
						<td colspan="5" >${item.receiveBasicInformation.receiveConsignerPlace}</td>
					</tr>
					<tr>
						<td>收货人:</td>
						<td >${item.receiveBasicInformation.receiveConsignee}</td>
						<td>收货人电话：</td>
						<td >${item.receiveBasicInformation.receiveConsigneeTell}</td>
						<td>收货人地址：</td>
						<td colspan="5" >${item.receiveBasicInformation.receiveConsigneePlace}</td>
					</tr>
					<tr>
						<td>付款方式:</td>
						<td >${item.receiveBasicInformation.receivePaymentMethod}</td>
						<td>总运费：</td>
						<td >${item.receiveBasicInformation.receive_gross_freight}</td>
						<td>总信息费：</td>
						<td >${item.receiveBasicInformation.receive_gross_messagefee}</td>
						<td>总提货费：</td>
						<td colspan="3" >${item.receiveBasicInformation.receive_gross_pickup_charge}</td>
					</tr>
					<tr>
						<td>是否代收货款:</td>
						<td >${item.receiveBasicInformation.receiveIscollectMoney}
						</td>
						<td>送货方式：</td>
						<td >${item.receiveBasicInformation.receiveShippingMethod}</td>
						<td>是否听通知发货：</td>
						<td colspan="5" >${item.receiveBasicInformation.receiveIsinformDeliver}</td>
					</tr>
					<tr>
						<td>备注：</td>
						<td colspan="9" >${item.receiveBasicInformation.receiveRemark}</td>
					</tr>
				</table>
			</form>
			
			
			<br/>
			<div style='width:1250px;'>
			
		
			<form id="goodsInfo">
				<table border="1" cellpadding="4px" width="1200px" class="table1">
					<tr>
						<td colspan="13">货物信息</td>
					</tr>
					<tr>
						<td width="50px">序号</td>
						<td width="170px">货物编号</td>
						<td width="250px">货物名称</td>
						<td width="250px">货物规格</td>
						<td width="100px">包装方式</td>
						<td width="90px">数量（件）</td>
						<td width="90px">重量（KG）</td>
						<td width="90px">体积（m³）</td>
						<td width="70px">运费</td>
						<td width="70px">信息费</td>
						<td width="70px">提货费</td>
						<td width="120px">仓库</td>
						<td width="130px">备注</td>
					</tr>
					 @for(receiveGoodsInformation   in   item.receiveGoodsInformations){ 
					<tr id="a">
						<td >${receiveGoodsInformationLP.index}</td>
						<td >${receiveGoodsInformation.receiveGoodsId}</td>
						<td >${receiveGoodsInformation.receiveGoodsName}</td>
						<td >${receiveGoodsInformation.receiveGoodsModel}</td>
						<td >${receiveGoodsInformation.receiveGoodsPackage}</td>
						<td class="receiveGoodsQuantity">${receiveGoodsInformation.receiveGoodsQuantity}</td>
						<td class="receiveGoodsWeight">${receiveGoodsInformation.receiveGoodsWeight}</td>
						<td class="receiveGoodsVolume">${receiveGoodsInformation.receiveGoodsVolume}</td>
						<td>${receiveGoodsInformation.receiveGoodsFreight}</td>
						<td>${receiveGoodsInformation.receiveGoodsMessagefee}</td>
						<td>${receiveGoodsInformation.receiveGoodsPickupCharge}</td>
						<td>${receiveGoodsInformation.receiveGoodsWarehouseName}</td>
						<td>${receiveGoodsInformation.receiveGoodsRemark}</td>
					</tr>
					@}
					<tr>
						<td colspan="5">总计:</td>
						<td id="1"></td>
						<td id="2"></td>
						<td id="3"></td>
						<td>${item.receiveBasicInformation.receive_gross_freight}</td>
						<td>${item.receiveBasicInformation.receive_gross_messagefee}</td>
						<td>${item.receiveBasicInformation.receive_gross_pickup_charge}</td>
						<td colspan="3"></td>
					</tr>
				</table>
				</form>
					</div>
				</div>
				
				<input id="isFinish" type="hidden" value="${item.receiveBasicInformation.receiveIsfinish}">
            <div class="row btn-group-m-t">
             	<div class="col-sm-5">
                </div>
                <div class="col-sm-2">
                 @if(shiro.hasPermission("/receiveBasicInformation/print")){
                                <#button btnCss="info" name="收货信息打印" icon="fa-edit" clickFun="preview()"/>
                            @}
                </div>
                
                 @if(shiro.hasPermission("/receiveBasicInformation/anti")){
                			 <div id="anti" class="col-sm-1">
                                <#button name="反审核" btnCss="info" icon="fa-check" clickFun="ReceiveBasicInformationInfoDlg.editSubmit()"/>
                            	 </div>
                            	<script>
                            	$(function(){
                            		var isFinish = $("#isFinish").val();
                            		if (isFinish=="未完成"||isFinish=="已完成"){
                            			$("#anti").hide();
                            		alert("正在进行或者已经完成的合同不提供反审核功能！");
                            		}
                            	});
                            	</script>
                            @}
                <div class="col-sm-1">
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="ReceiveBasicInformationInfoDlg.close()"/>
                </div>
               <div class="col-sm-3">
                </div>
            </div>
        </div>
        <!--startprint-->
        <div id="print" style="display:none">
        	<table>
        		<tr><td colspan="7" align="center"><font size="3">${company.companyName}货物托运单</font></td></tr>
        		<tr>
        			<td>至</td>
        			<td>${tool.dateType(item.receiveBasicInformation.receive_arrival_date)}</td>
        			<td>公司电话：${company.companyTell}</td>
        			<td></td>
        			<td>货物查询电话</td>
        			<td>${company.companyContactTell}</td>
        			<td>0533—20888881</td>
        		</tr>
        		<tr>
        			<td>托运人</td>
        			<td>${item.receiveBasicInformation.receiveConsigner}</td>
        			<td colspan="3"></td>
        			<td>托运人电话</td>
        			<td>${item.receiveBasicInformation.receiveConsignerTell}</td>
        		</tr>
        		<tr>
        			<td>收货人</td>
        			<td>${item.receiveBasicInformation.receiveConsignee}</td>
        			<td colspan="3"></td>
        			<td>收货人电话</td>
        			<td>${item.receiveBasicInformation.receiveConsigneeTell}</td>
        		</tr>
        		<tr>
        			<td colspan="7">
        			<table border="1" width='100%' height='100%'>
        				<tr>
        				<td>货物名称</td>
        				<td>数量（件）</td>
        				<td>重量（KG）</td>
        				<td>体积（立方米）</td>
        				<td>总运费</td>
        				<td>付款方式</td>
        				<td>送达方式</td>
        				</tr>
        				 @for(receiveGoodsInformation   in   item.receiveGoodsInformations){ 
        				<tr>
        				<td>${receiveGoodsInformation.receiveGoodsName}</td>
        				<td>${receiveGoodsInformation.receiveGoodsQuantity}</td>
        				<td>${receiveGoodsInformation.receiveGoodsWeight}</td>
        				<td>${receiveGoodsInformation.receiveGoodsVolume}</td>
        				<td>${receiveGoodsInformation.receiveGoodsFreight}</td>
        				<td>${item.receiveBasicInformation.receivePaymentMethod}</td>
        				<td>${item.receiveBasicInformation.receiveShippingMethod}</td>
        				</tr>
        				@}
        			</table>
        			</td>
        		</tr>
        		<tr><td colspan="7">1.托运货物中不准夹带危险物品、金银、珠宝等国家禁运物品；</td></tr>
        		<tr><td colspan="7">2.托运方可自行办理保险，也可由承运方代办，若不办理货运保险，货物损失按运价的两倍之内赔偿；</td></tr>
        		<tr><td colspan="7">3.托运方应及时支付承运方运费；</td></tr>
        		<tr><td colspan="7">4.托运方应如实告知货物的重量、体积、卸货地址等相关信息，否则，承运方有权滞留货物，并提出相关赔偿；</td></tr>
        		<tr><td colspan="7">5.托运方与承运方双方签字或盖章后生效。</td></tr>
        		<tr><td >托运方：</td><td colspan="4"></td><td >承运方</td><td></td></tr>
        		<tr><td></td><td colspan="6">第一联(白):存根    第二联(红):客户    第三联(黄):随货同行    第四联(蓝):分流点</td></tr>
        	</table>
        </div>
        <!--endprint-->
    </div>
</div>
<script src="${ctxPath}/static/modular/query/receiveBasicInformation/receiveBasicInformation_info.js"></script>
<script>


function preview()    
{    
		$("#print").show();
		bdhtml=window.document.body.innerHTML; 

		sprnstr="<!--startprint-->"; //开始打印标识字符串有17个字符

		eprnstr="<!--endprint-->"; //结束打印标识字符串

		prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); //从开始打印标识之后的内容

		prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); //截取开始标识和结束标识之间的内容

		window.document.body.innerHTML=prnhtml; //把需要打印的指定内容赋给body.innerHTML
		
		if (!!window.ActiveXObject || "ActiveXObject" in window) { //是否ie
			   remove_ie_header_and_footer();
			 }

		window.print(); //调用浏览器的打印功能打印指定区域

		window.document.body.innerHTML=bdhtml; // 最后还原页面
		$("#print").hide();
}  
	 function remove_ie_header_and_footer() {
	  var hkey_path;
	  hkey_path = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
	  try {
	   var RegWsh = new ActiveXObject("WScript.Shell");
	   RegWsh.RegWrite(hkey_path + "header", "");
	   RegWsh.RegWrite(hkey_path + "footer", "");
	  } catch (e) {
	  }
	 }
</script> 
<script>
function initCount(){
	var d = 0;
	$(".receiveGoodsQuantity").each(function(){
		var count ;
		count=Number($(this).text());
        	d += count;
	});
	$("#1").text(d);
	
	var e = 0;
	$(".receiveGoodsWeight").each(function(){
		var count ;
		count=Number($(this).text());
        	e += count;
	});
	$("#2").text(e);
	
	var f = 0;
	$(".receiveGoodsVolume").each(function(){
		var count ;
		count=Number($(this).text());
        	f += count;
	});
	$("#3").text(f);
}
$(function(){
	initCount();
	$("#print").hide();
});
</script>
@}
